package com.itheima.mysream;

import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;

public class StreamDemo3 {
    public static void main(String[] args) throws IOException {
        //读取本地文件数据
        FileReader fr = new FileReader("myio\\a.txt");
        char[] chars = new char[2];
        int len;
        while((len = fr.read(chars))!= - 1){
            System.out.print(new String(chars,0,len));
        }
        //进行资源释放
        fr.close();
    }
}
